package com.zhoux.api.io.io;

import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

/**
 * @author taoyi
 * @version 1.0
 * @date 2021/3/17 9:12
 *
 * 本类用于测试高效字节流输出
 */
public class Out_Test {
    public static void main(String[] args) {
        method();
    }

    public static void method() {
        OutputStream out = null;
        try {
            // 创建高效字节流输出对象
            out = new BufferedOutputStream(new FileOutputStream("E:\\SoftwareEngineering\\java\\IO\\hello.txt"));
            // 输出数据
            out.write('2');
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            try {
                // 关闭资源
                out.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

}

